﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using SachOnlineLibrary.Public;
using SachOnlineLibrary.DAL;
namespace SachOnlineLibrary.BLL
{
    public class ChuDeBLL
    {
        ChuDeDAL chude = new ChuDeDAL();
        public List<Loai> LietKeTatCaChuDe()
        {
            List<Loai> listcontrolchude = new List<Loai>();
            DataTable dt = new DataTable();
            dt = chude.LietKeTatCaChuDe();
            foreach (DataRow dr in dt.Rows)
            {
                Loai controlloai = new Loai();
                controlloai.ChuyenDoi(dr);
                listcontrolchude.Add(controlloai);
            }
            return listcontrolchude;
        }
        public bool SuaTheLoai(Loai suachude)
        {
            return chude.SuaTheLoai(suachude.MaLoai,suachude.TenLoai);
        }
        public bool ThemTheLoai(Loai themchude)
        {
            return chude.ThemTheLoai(themchude.TenLoai);
        }
        public bool XoaTheLoai(Loai xoachude)
        {
            return chude.XoaTheLoai(xoachude.MaLoai);
        }
    }
}
